package br.com.center.loja.mb;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

import br.com.center.loja.model.User;
import br.com.center.loja.model.UserType;

@ViewScoped
@ManagedBean(name="user")
public class UserMB extends AbstractMB<User>{
	
	private static final long serialVersionUID = 1L;

	public UserMB() {
		super(User.class);
	}

	public SelectItem[] getUserTypes(){
		UserType[] userTypes = UserType.values();
		SelectItem[] result = new SelectItem[userTypes.length];
		int position = 0;
		
		for (UserType userType : userTypes) {
			result[position++] = new SelectItem(userType, 
					                            userType.getDescription());
		}
		
		return result;
	}
}
